print 'Content-Type: text/html'
print ''

from google.appengine.api import users
from google.appengine.ext import db

# class UserPrefs(db.Model):
#  users = db.UserProperty()

user = users.get_current_user()
if user:
  print "Logged in. Boo Hoo " + user.user_id()
#  q = db.GqlQuery("SELECT * FROM UserPrefs WHERE user = :1", user)
#  userprefs = q.get()
#  for p in userprefs:
#    print p + "<br/>"
else:
  print "Not logged in.<br/>"
  print ("<a href=\"%s\">Sign in or register</a>." % users.create_login_url("/userinfo"))

